package com.haidong.string;

import java.util.Scanner;

public class StringTest2 {
    public static void main(String[] args) {
        String rightName = "root";
        String rightPassword = "12345678";

        Scanner sc = new Scanner(System.in);
        for (int i = 0;i < 3;i++) {
            System.out.print("请输入账号:");
            String name = sc.next();
            System.out.print("请输入密码:");
            String password = sc.next();
            if(name.equals(rightName) && password.equals(rightPassword)){
                System.out.println("登录成功!");break;
            }
            else{
                System.out.println("账号或密码错误!");
            }
        }

        System.out.print("请输入你的手机号码:");
        String phoneNumber = sc.next();
        System.out.println(phoneNumber.substring(0,3) + "****" +phoneNumber.substring(7,11));
    }
}
